//
//  AccountSecurityVM.swift
//  LeTu
//
//  Created by g1 on 2024/3/2.
//

import Foundation

class AccountSecurityVM {
    
    private(set) var items = [[ListSectionItem]]()

    init() {
        updateItems()
    }
    
    /// 更新页面数据
    func updateItems() {
        
        items = [[ListSectionItem(title: "设置密码".localized)]]
        
    }
    
    /// 注销账号
    func destoryAccount(completeHandle: @escaping NetworkRequestHandle) {
        
        apiProvider.request(api: .destoryAccount) { json, jsonArr, code in
            MYLog("注销账号：",json)
            
            var dialog = DialogMessage()
            
            guard code == 200, let pm = Mapper<ResponseModel>().map(JSON: json) else { return completeHandle(dialog) }
            dialog.code = pm.code
            dialog.message = pm.msg
            completeHandle(dialog)
            
        } failureHandler: { error in
            completeHandle(DialogMessage())
        }
                
    }
    
}

